
//
//  ZZScrollBtn.m
//  新项目
//
//  Created by 刘耀宗 on 2017/3/15.
//  Copyright © 2017年 刘耀宗. All rights reserved.
//

#import "ZZScrollBtn.h"

@implementation ZZScrollBtn
+ (instancetype)btnWithTitle:(NSString *)title {
    // 创建 频道标签
    ZZScrollBtn *channelLabel = [[self alloc] init];
    // 设置字体
    channelLabel.titleLabel.font = [UIFont systemFontOfSize:18];
    // 设置内容
    [channelLabel setTitle:title forState:UIControlStateNormal];
    [channelLabel setBackgroundColor:CXBColor(201, 202, 202)];
    [channelLabel setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    // 自适应大小
    [channelLabel sizeToFit];
    // 设置可交互
    channelLabel.userInteractionEnabled = YES;
    channelLabel.layer.cornerRadius=5;
    channelLabel.layer.masksToBounds=YES;
    
//    channelLabel.textAlignment = NSTextAlignmentCenter;
    
    // 设置字体
    channelLabel.titleLabel.font = [UIFont systemFontOfSize:14];
//    [channelLabel addTarget:self action:@selector(click) forControlEvents:UIControlEventTouchUpInside];
    
    return channelLabel;
}
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event 
{
    if (self.selectedlabel) {
        self.selectedlabel();
    }

}


@end
